package com.sikaryofficial.backend.constant;

import cn.hutool.core.text.CharSequenceUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author : qinjinyuan
 * @desc : 店铺数据来源
 * @date : 2023/11/06 16:31
 */
@Getter
@AllArgsConstructor
public enum StoreSourceEnum {

    /**
     * 数据来源：manual-手工; evaluate-评价
     */
    MANUAL("manual", "手工导入店铺"),
    EVALUATE("evaluate", "用户评价的店铺"),
    ;
    private final String code;
    private final String name;

    public static StoreSourceEnum getStoreSourceEnum(String code) {
        return Arrays.stream(StoreSourceEnum.values())
                .filter(sourceEnum -> CharSequenceUtil.equals(sourceEnum.getCode(), code))
                .findFirst().orElse(null);
    }
}
